package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.PrizeWidgetRelation;
import com.jingdun.sport.dao.PrizeWidgetRelationMapper;
import com.jingdun.sport.service.PrizeWidgetRelationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
@AllArgsConstructor
public class PrizeWidgetRelationServiceImpl extends ServiceImpl<PrizeWidgetRelationMapper, PrizeWidgetRelation> implements PrizeWidgetRelationService {

    private PrizeWidgetRelationMapper prizeWidgetRelationMapper;

    public void addPrizeWidgetRelation(PrizeWidgetRelation prizeWidgetRelation){
        prizeWidgetRelationMapper.addPrizeWidgetRelation(prizeWidgetRelation);
    }

    public List<PrizeWidgetRelation> getPrizeWidgetRelationDuplicateCheckList(@Param("params") Map<String, Object> m){
        return prizeWidgetRelationMapper.getPrizeWidgetRelationDuplicateCheckList(m);
    }

    public List<PrizeWidgetRelation> getPrizeWidgetRelationIdList(@Param("params") Map<String, Object> m){
        return prizeWidgetRelationMapper.getPrizeWidgetRelationIdList(m);
    }
    
    public void updatePrizeWidgetRelation(PrizeWidgetRelation prizeWidgetRelation){
        prizeWidgetRelationMapper.updatePrizeWidgetRelation(prizeWidgetRelation);
    }
    
    public Page<Map<String, Object>> getPaginationPrizeWidgetRelation(@Param("params") Map<String, Object> m){
        //新建分页
        Page<Map<String,Object>> page = new Page<Map<String,Object>>((long)m.get("current"), (long)m.get("size"));
        //返回结果
        page.setRecords(this.baseMapper.getPaginationPrizeWidgetRelation(page, m));
        return page;
    }

    public PrizeWidgetRelation getPrizeWidgetRelationDetail(@Param("params") Map<String, Object> m){
        return prizeWidgetRelationMapper.getPrizeWidgetRelationDetail(m);
    }
}
